//package com.hundun.vision.biz.strategy;
//
//import com.hundun.vision.biz.enums.IndicatorEnums;
//import com.hundun.vision.biz.engine.IndicatorFactory;
//import org.ta4j.core.BarSeries;
//import org.ta4j.core.BaseStrategy;
//import org.ta4j.core.Indicator;
//import org.ta4j.core.Rule;
//import org.ta4j.core.indicators.helpers.ClosePriceIndicator;
//import org.ta4j.core.rules.CrossedDownIndicatorRule;
//import org.ta4j.core.rules.CrossedUpIndicatorRule;
//
///**
// * @author ：RuoChen
// * @date ：14:10 2024/2/27
// * @description：交易策略一
// */
//public class StrategyBackup {
//
//    /**
//     * 构建交易策略
//     *
//     * @param barSeries
//     * @param barSeries
//     * @return
//     */
//    public org.ta4j.core.Strategy buildStrategy(BarSeries barSeries) {
//        // 定义MACD指标的参数
//        int shortBarCount = 12;
//        int longBarCount = 26;
//        int signalBarCount = 9;
//
//        // 创建MACD指标
//        ClosePriceIndicator closePrice = new ClosePriceIndicator(barSeries);
////        EMAIndicator shortEma = new EMAIndicator(closePrice, shortBarCount);
////        EMAIndicator longEma = new EMAIndicator(closePrice, longBarCount);
////        MACDIndicator macd = new MACDIndicator(closePrice, shortBarCount, longBarCount);
////        EMAIndicator macdSignal = new EMAIndicator(macd, signalBarCount);
////
////        // 定义买入规则
////        Rule buyRule = new CrossedUpIndicatorRule(macd, macdSignal).and(new CrossedUpIndicatorRule(macd, 0.0));
////
////        // 定义卖出规则
////        Rule sellRule = new CrossedDownIndicatorRule(macd, macdSignal).and(new CrossedDownIndicatorRule(macd, 0.0));
//
////        // 定义买入规则
////        Rule buyRule = new CrossedUpIndicatorRule(shortEma, longEma)
////                .and(new CrossedUpIndicatorRule(macd, macdSignal))
////                .and(new CrossedUpIndicatorRule(macd, 0.0));
////
////        // 定义卖出规则
////        Rule sellRule = new CrossedDownIndicatorRule(shortEma, longEma)
////                .and(new CrossedDownIndicatorRule(macd, macdSignal))
////                .and(new CrossedDownIndicatorRule(macd, 0.0));
//
//        Indicator macd = IndicatorFactory.getIndicator(IndicatorEnums.MACD, barSeries, null, 12, 26);
//        Indicator stochasticK = IndicatorFactory.getIndicator(IndicatorEnums.KDJ_K, barSeries, 9, null, null);
//        Indicator stochasticD = IndicatorFactory.getIndicator(IndicatorEnums.KDJ_D, barSeries, 9, null, null);
//        Indicator bollUpper = IndicatorFactory.getIndicator(IndicatorEnums.BOLL_UPPER, barSeries, 20, null, null);
//        Indicator bollLower = IndicatorFactory.getIndicator(IndicatorEnums.BOLL_LOWER, barSeries, 20, null, null);
//
//        // 定义买入规则:收盘价格上穿BOLL下线时买入
//        Rule buyRule = new CrossedUpIndicatorRule(closePrice, bollLower);
//
//        // 定义卖出规则:收盘价格下穿BOLL上线时卖出
//        Rule sellRule = new CrossedDownIndicatorRule(closePrice, bollUpper);
//
//        org.ta4j.core.Strategy strategy = new BaseStrategy(buyRule, sellRule);
//        return strategy;
//    }
//}
